﻿@model Occupie.Models.Language
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

@using (Ajax.BeginForm("AddLanguage", new AjaxOptions
                        {
                            HttpMethod = "POST",
                            InsertionMode = InsertionMode.Replace,
                            UpdateTargetId = "edit-personal",
                            OnSuccess = "onSuccess"
                        }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            <br />
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Proficiency)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.Proficiency, new SelectList(Occupie.Utilities.GetProficiencies(), "Value", "Text"))
            @Html.ValidationMessageFor(model => model.Proficiency)
        </div>


        <p>
            <input type="submit" value="Добави" />
            <input type="button" id="cancelAdd" value="Отказ" onclick="closeLangDialog()" />
        </p>
}

<script>
    function onSuccess(ok,status,response) {
        closeLangDialog();
    }

    function closeLangDialog() {
        $("#langDialog").dialog("close");
    }

    $("#Proficiency").kendoDropDownList();
</script>
